<template>
    <div>
        <VoSchemaForm :model="model" :schema="schema"></VoSchemaForm>
        <div>
            <pre>{{modelJson}}</pre>
        </div>
        <div class="markdown-body">
            <CodeTpl></CodeTpl>
        </div>
    </div>
</template>

<script>
import CodeTpl from '@/views/md/sf/colorPicker.md';
export default {
    components: {
        CodeTpl
    },
    data() {
        return {
            model: {},
            schema: {
                properties: {
                    name1: {
                        label: '属性',
                        widget: 'colorPicker',
                        ui: {
                            size: 'mini',
                            showAlpha: true
                        }
                    },
                    name2: {
                        label: '预定义颜色',
                        widget: 'colorPicker',
                        enum: ['#F0F8FF', '#FAEBD7', '#00FFFF', '#7FFFD4', '#F0FFFF', '#000000', '#0000FF', '#8A2BE2', '#A52A2A']
                    },
                    name3: {
                        label: '异步选项',
                        widget: 'colorPicker',
                        enum: [],
                        asyncData(resolve) {
                            setTimeout(() => {
                                resolve(['#F0F8FF', '#FAEBD7', '#00FFFF', '#7FFFD4', '#F0FFFF', '#000000', '#0000FF', '#8A2BE2', '#A52A2A'])
                            }, 2000)
                        }
                    }
                },
                ui: {
                    labelWidth: 100
                },
                col: {
                    span: 12
                }
            }
        }
    },
    computed: {
        modelJson() {
            return JSON.stringify(this.model, null, 4)
        }
    }
}
</script>

<style>

</style>
